| Fully Qualified Name: | CodeIgniter\Validation\FormatRules |
Format validation Rules.
| Name | Description | Defined By |
|---|---|---|
| alpha() | Alpha | FormatRules |
| alpha_dash() | Alphanumeric with underscores and dashes | FormatRules |
| alpha_numeric() | Alphanumeric | FormatRules |
| alpha_numeric_punct() | Alphanumeric, spaces, and a limited set of punctuation characters. | FormatRules |
| alpha_numeric_space() | Alphanumeric w/ spaces | FormatRules |
| alpha_space() | Alpha with spaces. | FormatRules |
| decimal() | Decimal number | FormatRules |
| hex() | String of hexidecimal characters | FormatRules |
| integer() | Integer | FormatRules |
| is_natural() | Is a Natural number (0,1,2,3, etc.) | FormatRules |
| is_natural_no_zero() | Is a Natural number, but not a zero (1,2,3, etc.) | FormatRules |
| numeric() | Numeric | FormatRules |
| regex_match() | Compares value against a regular expression pattern. | FormatRules |
| string() | Any type of string | FormatRules |
| timezone() | Validates that the string is a valid timezone as per the timezone_identifiers_list function. | FormatRules |
| valid_base64() | Valid Base64 | FormatRules |
| valid_date() | Checks for a valid date and matches a given date format | FormatRules |
| valid_email() | Checks for a correctly formatted email address | FormatRules |
| valid_emails() | Validate a comma-separated list of email addresses. | FormatRules |
| valid_ip() | Validate an IP address (human readable format or binary string - inet_pton) | FormatRules |
| valid_json() | Valid JSON | FormatRules |
| valid_url() | Checks a URL to ensure it's formed correctly. | FormatRules |
Alpha
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Alphanumeric with underscores and dashes
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Alphanumeric
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Alphanumeric, spaces, and a limited set of punctuation characters.
Accepted punctuation characters are: ~ tilde, ! exclamation,
underscore, + plus, = equals, | vertical bar, : colon, . period ~ ! # $ % & * - + = | : .
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Alphanumeric w/ spaces
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Alpha with spaces.
| Parameter Name | Type | Description |
|---|---|---|
| $value | string | Value. |
Returns: bool True if alpha with spaces, else false.
Decimal number
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
String of hexidecimal characters
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Integer
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Is a Natural number (0,1,2,3, etc.)
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Is a Natural number, but not a zero (1,2,3, etc.)
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Numeric
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Compares value against a regular expression pattern.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $pattern | string |
Returns: bool
Any type of string
Note: we specifically do NOT type hint $str here so that it doesn't convert numbers into strings.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string|null |
Returns: bool
Validates that the string is a valid timezone as per the timezone_identifiers_list function.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Valid Base64
Tests a string for characters outside of the Base64 alphabet as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Checks for a valid date and matches a given date format
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $format | string |
Returns: bool
Checks for a correctly formatted email address
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Validate a comma-separated list of email addresses.
Example: valid_emails[one@example.com,two@example.com]
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Validate an IP address (human readable format or binary string - inet_pton)
| Parameter Name | Type | Description |
|---|---|---|
| $ip | string | IP |
| $which | string | IP |
Returns: bool
Valid JSON
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool
Checks a URL to ensure it's formed correctly.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string |
Returns: bool